﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using myschoolDal;

namespace school
{
    public partial class manshowstuinformation : Form
    {
        private long ID;
        private string name;
        private string major;
        private string grade;
        private string sex;
        private long NewID;

        public manshowstuinformation()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox2.Text != "")
            {
                name = textBox2.Text.ToString();
                manserver.ManChangeStuInformation_Name(ID, name);
            };
            if (comboBox1.SelectedText != "")
            {
                major = comboBox1.SelectedText.ToString();
                manserver.ManChangeStuInformation_Major(ID, major);
            };
            if (comboBox2.SelectedText != "")
            {
                grade = comboBox2.SelectedText.ToString();
                manserver.ManChangeStuInformation_grade(ID, grade);
            };
            if (radioButton1.Checked)
            {
                sex = "男";
                manserver.ManChangeStuInformation_Sex(ID, sex);
            }
            else if (radioButton2.Checked)
            {
                sex = "女";
                manserver.ManChangeStuInformation_Sex(ID, sex);
            };
        }

        private void textBox5_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox6_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox7_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox8_TextChanged(object sender, EventArgs e)
        {

        }

        private void manshowstuinformation_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox9.Text == "")
            {
                MessageBox.Show("错误：" + bug.Class1.worng4001, "提示");
            }
            else
            {
                ID = Convert.ToInt64(textBox9.Text);
                if (stuservers.CheckID(ID))
                {
                    dataGridView1.DataSource = manserver.GetStuInformation(ID).Tables[0].DefaultView;
                }
                else
                {
                    MessageBox.Show("错误：" + bug.Class1.wrong5002, "提示");
                }
            }
        }

        private void groupBox2_Enter(object sender, EventArgs e)
        {

        }
    }
}
